angular.module('export').controller('exportListCtrl', ['$scope', '$http', '$uibModal', '$timeout', function ($scope, $http, $uibModal, $timeout) {
    $scope.dataList = [];
    $scope.type = 'vote';

    $scope.onInit = function () {
        $http.get(ctx + '/export/list?type=' + $scope.type).then(function (resp) {
            console.log(resp);
            $scope.dataList = resp.data.dataList;
        });
    }
    $scope.onInit();
    $scope.changeType = function (type) {
        console.log(type);
        $scope.type = type;
        $scope.onInit();
    }

    $scope.see = function (id) {
        var modalInstance = $uibModal.open({
            // backdrop: 'static',
            templateUrl: 'app/modules/vote/vote.see.html',
            controller: 'voteSeeCtrl',
            resolve: {
                id: function () {
                    return id;
                }
            }
        });
        modalInstance.result.then(function () {
        }, function () {
        });
    }

    $scope.export = function () {
        window.location.href = ctx + '/export/export?type=' + $scope.type;
    }
}]);